Repository navigation
fix(ios): apply camera updates made while the map is off-window; replace deprecated image context - #4308
Merged
Conversation
…text The Images placeholder force-unwrapped UIGraphicsGetImageFromCurrentImageContext(), which traps when the context can't be created (reported on iOS 26). takeSnap had the same pattern. Fixes #4260. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GEzQRvQdtNT3hmJhbB3xp3
Mapbox cancels camera animations immediately while MapView has no window, so animated Camera stop updates issued on an inactive screen were dropped. Jump to the target instead. Fixes #4304. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GEzQRvQdtNT3hmJhbB3xp3
mfazekas
marked this pull request as ready for review
October 4, 2026 13:02
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Miklós · project thread
Description
Fixes #4304
Refs #4260 (cleanup only, crash not reproduced)
Two small iOS changes, one commit each (happy to split into two PRs).
#4260, deprecated image context in
ImagesandtakeSnap.RNMBXImages.placeholderImageforce-unwrappedUIGraphicsGetImageFromCurrentImageContext(), which traps when the legacy context can't be created. It now usesUIGraphicsImageRenderer, the same pattern already used inRNMBXNativeUserLocation,RNMBXImageandRNMBXPointAnnotation.RNMBXMapView.takeSnaphad the same force-unwrap and gets the same change.#4304, camera prop change on a detached map is lost. Mapbox's
MapView.didMoveToWindowsetscameraAnimatorsRunner.isEnabled = falsewhenwindow == nil, and the runner then cancels new animations immediately (checked in mapbox-maps-ios v11.23.1,CameraAnimatorsRunner.swift). SoflyTo/easeTo/linearTostops sent while the screen is inactive were dropped.moveToworks because it usessetCamera.CameraUpdateItem.executenow jumps withsetCamerawhen the map view has no window, which matches what Android does.Checklist
CONTRIBUTING.mdyarn generatein the root folder (no generated code affected)/exampleapp./example)Verification
The example app ran on an iPhone 17 Pro simulator (iOS 26.5, Xcode 26.6, MapboxMaps 11.23.1), with the reproducer components from the issues added temporarily. Both builds compiled with no errors or warnings.
#4304. I used the component from the issue, which reads
getCenter()5s after the screen is re-attached (A = -74.0060, 40.7143 and B = -73.9500, 40.7800).#4260. This did not reproduce on the simulator or on a physical iPhone 13 mini running iOS 26.6.2 (Release builds of main and this PR):
placeholderImage. For a new URL image,addImages(oldImages: [:])skips the placeholder branch. The placeholder is only built when images are re-added after an image has loaded but is missing from the style.placeholderImagewas forced on main, the deprecatedUIGraphicsBeginImageContextWithOptionspath returned a valid 1x1 image on iOS 26.6.2.takeSnap(false)returned an image on both builds, and there were no crash logs.So the root cause in #4260 is unconfirmed. The commit stays as a cleanup that removes a deprecated API and two force-unwraps, but it does not claim to close the issue.
Component to reproduce the issue you're fixing
See the components in #4260 and #4304.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GEzQRvQdtNT3hmJhbB3xp3